-- @owner: @nanyang12
-- @date: 2024/10/23
-- @testpoint:connect by基表为连接表且连接条件有过滤

--step1:建表
drop table if exists t_connect_by_0032_01,t_connect_by_0032_02;
create table t_connect_by_0032_01(id int, lid int, name text);
create table t_connect_by_0032_02(id int, lid int, name text);
--step2:插入数据
insert into t_connect_by_0032_01 values(1,null,'A'),(2,1,'B'),(3,2,'C');
insert into t_connect_by_0032_02 values(1,null,'A'),(2,1,'B'),(3,2,'C'), (4,3,'D');
--step3:connect by查询
select * from t_connect_by_0032_02,t_connect_by_0032_01 where t_connect_by_0032_01.id=t_connect_by_0032_02.id and t_connect_by_0032_01.id!=2 start
with t_connect_by_0032_01.id=2 connect by prior t_connect_by_0032_02.id=t_connect_by_0032_01.lid;
--step4:清理环境
drop table if exists t_connect_by_0032_01,t_connect_by_0032_02;
